package com.bestcem.xm.wallet.grpc.client.converter;

import com.bestcem.bp.pay.grpc.v1.common.FinanceArgs;
import com.bestcem.bp.pay.grpc.v1.services.RechargeArgs;
import com.bestcem.bp.pay.grpc.v1.services.RechargeInfo;
import com.bestcem.bp.pay.grpc.v1.services.RechargeMiniProgramRequest;
import com.bestcem.xm.wallet.grpc.client.dto.WalletFinanceDTO;
import com.bestcem.xm.wallet.grpc.client.dto.WalletRechargeDTO;
import com.bestcem.xm.wallet.grpc.client.param.RechargeMiniProgramParam;
import com.bestcem.xm.wallet.service.dto.WalletRechargeInfoDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.NullValueCheckStrategy;

/**
 * 公司钱包转换类-自定义转换
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/5/16 15:50
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface WalletGrpcConvert {

    RechargeArgs dto2RechargeArgsGrpc(WalletRechargeDTO rechargeDTO);

    FinanceArgs dto2FinanceArgsGrpc(WalletFinanceDTO financeDTO);

    WalletRechargeInfoDTO rechargeInfoGrpc2Dto(RechargeInfo rechargeInfo);

    @Mappings({
            @Mapping(target = "openId", source = "openId"),
            @Mapping(target = "platformCode", source = "platformCode"),
            @Mapping(target = "walletId", source = "walletId"),
            @Mapping(target = "rechargeArgs.amount", source = "amount"),
            @Mapping(target = "rechargeArgs.title", source = "title"),
            @Mapping(target = "rechargeArgs.product", source = "product"),
            @Mapping(target = "rechargeArgs.tradeType", source = "tradeType"),
            @Mapping(target = "rechargeArgs.fee", source = "fee"),
            @Mapping(target = "callbackUrl", source = "callbackUrl"),
            @Mapping(target = "financeArgs.opUserId", source = "opUserId"),
            @Mapping(target = "financeArgs.opUserName", source = "opUserName"),
            @Mapping(target = "financeArgs.remark", source = "remark"),
    })
    RechargeMiniProgramRequest rechargeMiniProgramParam2Grpc(RechargeMiniProgramParam param);
}
